<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>添加</title>
<link rel="stylesheet" type="text/css"
	href="asserts/bootstrap-3.3.7-dist/css/bootstrap.min.css" />

<!-- js插件 -->
<script src="js/jquery-3.2.1.min.js"></script>
<script src="asserts/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css"
	href="asserts/bootstrapValidate/css/bootstrapValidator.min.css" />
<script src="asserts/bootstrapValidate/js/bootstrapValidator.min.js"></script>

</head>
<body>
	<div>
		<!-- 导航 -->
		<ol class="breadcrumb">
			<li><i class="fa fa-comment"></i> 国家资助管理</li>
		</ol>
		<div class="container">
			<div class="row">
				<form action="countrysub/updateByCountrySub" method="post" class="form-horizontal">
					<!-- 受助项目-->
					<!-- 隐藏域 修改是根据id找的 -->
					<input type="text" name="id" style="display:none" value="" class="form-control" />
					<div class="form-group">
						<label class="control-label col-md-3">受助项目：</label>
						<div class="col-md-8">
							<select name="project" class="form-control">
								 
							</select>
						</div>
					</div>
					<!-- 学校-->
					<div class="form-group">
						<label class="control-label col-md-3">选择学校：</label>
						<div class="col-md-8">
							<select name="schid" class="form-control">
								<option value="">请选择</option>
								
							</select>
						</div>
					</div>

					<div class="form-group">
						<label class="control-label col-md-3">姓名：</label>
						<div class="col-md-8">
							<input type="text" name="name" placeholder="请输入姓名"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">性别：</label>
						<div class="col-md-8">
							<div class="radio">
								<label> <input type="radio" name="sex" value="男" id="nan" >
									男
								</label> <label> <input type="radio" name="sex" value="女" id="nv" >
									女
								</label>
							</div>

						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">年级：</label>
						<div class="col-md-8">
							<input type="text" name="grade" placeholder="请输入年级（如  一年级）"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">班级：</label>
						<div class="col-md-8">
							<input type="text" name="classes" placeholder="请输入班级"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">身份证号：</label>
						<div class="col-md-8">
							<input type="text" name="idcard" placeholder="请输入身份证号"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">学籍号：</label>
						<div class="col-md-8">
							<input type="text" name="stucode" placeholder="请输入学籍号"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">受助类别：</label>
						<div class="col-md-8">
							<select name="type" class="form-control">
								<option value="">请选择</option>
								<option value="建档立卡贫困家庭子女">建档立卡贫困家庭子女</option>
								<option value="低保家庭子女">低保家庭子女</option>
								<option value="特困人员">特困人员</option>
								<option value="孤儿">孤儿</option>
								<option value="烈士子女">烈士子女</option>
								<option value="残疾学生">残疾学生</option>
								<option value="其他家庭经济困难学生">其他家庭经济困难学生</option>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">详细原因：</label>
						<div class="col-md-8">
							<input type="text" name="descinfo" placeholder="请输入详细原因"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">省：</label>
						<div class="col-md-8">
							<input type="text" name="province" placeholder="请输入省（如  湖北省）"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">市：</label>
						<div class="col-md-8">
							<input type="text" name="city" placeholder="请输入市（如  武汉市）"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">县：</label>
						<div class="col-md-8">
							<input type="text" name="xian" placeholder="请输入县"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">镇：</label>
						<div class="col-md-8">
							<input type="text" name="town" placeholder="请输入镇"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">村：</label>
						<div class="col-md-8">
							<input type="text" name="country" placeholder="请输入村"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">村组：</label>
						<div class="col-md-8">
							<input type="text" name="countrygroup" placeholder="请输入村组"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">家长姓名：</label>
						<div class="col-md-8">
							<input type="text" name="parentname" placeholder="请输入家长姓名"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">与学生关系：</label>
						<div class="col-md-8">
							<input type="text" name="relation" placeholder="请输入与学生关系"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">联系电话：</label>
						<div class="col-md-8">
							<input type="text" name="phone" placeholder="请输入联系电话"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">银行卡或存折号：</label>
						<div class="col-md-8">
							<input type="text" name="bankno" placeholder="请输入银行卡"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">银行名称：</label>
						<div class="col-md-8">
							<input type="text" name="bankname" placeholder="请输入银行名称"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3">资助金额或免学费金额（元）：</label>
						<div class="col-md-8">
							<input type="text" name="amount" placeholder="请输入资助金额"
								class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-md-3"> </label>
						<div class="col-md-8">
							<div class="col-md-6">
								<button class="btn btn-primary btn-block">录入</button>
							</div>
							<div class="col-md-6">
								<button class="btn btn-danger btn-block" type="reset">取消</button>
							</div>
						</div>
					</div>

				</form>
			</div>
		</div>
	</div>
	<script type="text/javascript">
		//工具方法 获取url的参数
		function GetRequest() {
			var url = location.search; //获取url中"?"符后的字串   
			var theRequest = new Object();
			if (url.indexOf("?") != -1) {
				var str = url.substr(1);
				strs = str.split("&");
				for (var i = 0; i < strs.length; i++) {
					theRequest[strs[i].split("=")[0]] = unescape(strs[i]
							.split("=")[1]);
				}
			}
			return theRequest;
		}

		$(function() {
			// 页面加载时  查询 分类 并放入 div中 

			//先获取参数id 根据id查询用户条件
			var Request = new Object();
			Request = GetRequest();
			var empid = Request['id'];

			$.ajax({
				type : "post",
				url : "countrysub/findByIdJson",
				dataType : "JSON",
				//contentType:"text/html;charset=UTF-8", 
				data : "id=" + empid,
				success : function(result) {
					//alert(result);
					$("input[name='id']").attr("value", result.id);
					$("input[name='project']").attr("value", result.project);
					$("input[name='schid']").attr("value", result.schid);
					$("input[name='name']").attr("value", result.name);
					//$("input[name='sex']").attr("placeholder", result.sex); 默认checked="checked"
					if(result.sex=='男'){
						$("#nan").attr("checked", "checked");
					}else{
						$("#nv").attr("checked", "checked");
					}
					$("input[name='grade']").attr("value", result.grade);
					$("input[name='classes']").attr("value", result.classes);
					$("input[name='idcard']").attr("value", result.idcard);
					$("input[name='stucode']").attr("value", result.stucode);
					$("input[name='type']").attr("value", result.type);
					//$("input[name='descinfo']").attr("placeholder", result.descinfo);
					$("input[name='province']").attr("value", result.province);
					$("input[name='city']").attr("value", result.city);
					$("input[name='xian']").attr("value", result.xian);
					$("input[name='town']").attr("value", result.town);
					$("input[name='country']").attr("value", result.country);
					$("input[name='countrygroup']").attr("value", result.countrygroup);
					$("input[name='parentname']").attr("value", result.parentname);
					$("input[name='relation']").attr("value", result.relation);
					$("input[name='phone']").attr("value", result.phone);
					$("input[name='bankno']").attr("value", result.bankno);
					$("input[name='bankname']").attr("value", result.bankname);
					$("input[name='amount']").attr("value", result.amount);
					//$("input[name='parentname']").attr("placeholder", result.parentname);
				}
			})
		});
		
		
		
	</script>
	
</body>
</html>
